#ifndef GEOM_EQUATIONSTEST_H_
#define GEOM_EQUATIONSTEST_H_

#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>

#include "../src/math/math.h"

using physicsworks::math::Vec3;
using physicsworks::math::Plane;
using physicsworks::math::equal;

class GeomEquationsTest : public CppUnit::TestFixture
{
	CPPUNIT_TEST_SUITE(GeomEquationsTest);
	CPPUNIT_TEST(testPlaneEquation);
	CPPUNIT_TEST_SUITE_END();
	
private:
	Plane<float>* plane0;

public:
	void setUp() {
		plane0 = new Plane<float>(Vec3<float>(5, 0, 3), Vec3<float>(5, 5, 3), Vec3<float>(2.5, 2.5, 3));
	}
	
	void testPlaneEquation() {
		CPPUNIT_ASSERT( equal(plane0->getNormal().x, 0.0f) );
		CPPUNIT_ASSERT( equal(plane0->getNormal().y, 0.0f) );
		CPPUNIT_ASSERT( equal(plane0->getNormal().z, 1.0f) );
		CPPUNIT_ASSERT( equal(plane0->getDistance(), 3.0f) );
		
		CPPUNIT_ASSERT( plane0->inFront(Vec3<float>(3.0, 3.0, 3.1)) );
		CPPUNIT_ASSERT( plane0->inBack(Vec3<float>(3.0, 3.0, 2.9)) );
		CPPUNIT_ASSERT( plane0->inside(Vec3<float>(1.0, 1.0, 3.0)) );
	}
		
	void tearDown() {
		delete plane0;
	}
};


#endif /*GEOM_EQUATIONSTEST_H_*/
